home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
util
/
simulare.sit
/
Simula 4.07 Reference
/
card_33570.txt
< prev
next >
Wrap
Text File
|
1989-05-02
|
2KB
|
81 lines
-- card: 33570 from stack: in.07 Reference
-- bmap block id: 0
-- flags: 0000
-- background id: 13647
-- name:
-- part 1 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=309 top=67 right=292 bottom=463
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 8192
-- line height: 12
-- part name:
-- part 2 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=81 top=245 right=267 bottom=165
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Parameters
----- HyperTalk script -----
on mouseUp
go to card id 40406
end mouseUp
-- part contents for background part 1
----- text -----
The user can define his own types with the
Class mechanism. Class abstractions contain
both data and operations. These are all called
attributes of the class.
Each instance of a class (an object) has its own
copy of the attributes. When an object is created
the parameters must be supplied and its body is
executed.
-- part contents for background part 2
----- text -----
Class definition
-- part contents for card part 1
----- text -----
class Stack(size); integer size;
begin integer Top;
integer array Storage(1:size);
procedure Push(v); integer v;
begin
if Top>Size then Error("Overflow");
Top:=Top+1; Storage(Top):=v;
end --- Push --- ;
integer procedure Pop;
begin
if Top=0 then Error("Underflow");
Pop:=Storage(Top); Top:=Top-1;
end -- Pop --- ;
! ---- class body ---- ;
Top:=0;
end --- Stack ---;